Skip to content

Write YAML configs before the test that needs them on a cold start - #79

Open
Tsyklop wants to merge 1 commit into
mainfrom
bug/yaml-config-test-cold-start
Open

Tsyklop wants to merge 1 commit into
mainfrom
bug/yaml-config-test-cold-start

Conversation

@Tsyklop

@Tsyklop Tsyklop commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

AddNewItemYamlTest > test new task file added fails with NullPointerException at AddNewItemYamlTest.kt:57 when it's the first test of a JVM with empty IDE caches. That is what CI has: it failed "Check the plugin for 261" on #68, whose changes don't touch YAML.

Cause

createConfigFiles calls YamlFormatSynchronizer.saveAll, which writes every config inside project.invokeLater, and then relies on UIUtil.dispatchAllInvocationEvents() to run them. In the first test on a cold start, that call doesn't run them. Calling it in a loop for 5 seconds didn't help either: the runnables ran only after the test body, so the task config was missing at line 57.

PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue() does run them. It releases the write-intent lock while it dispatches, and returns only after an invokeLater scheduled after them has run.

Fix

createConfigFiles uses PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue(). All its callers run on the EDT outside a write action, which that method requires.

Testing

Locally on 263, with the test sandbox's system-test directory removed before each run:

  • Before the fix, every cold run failed: 3 runs of AddNewItemYamlTest alone and 1 of the YAML test subset. The same subset passed with warm caches.
  • With the fix, AddNewItemYamlTest alone passed 2 of 2 cold runs.
  • Full :intellij-plugin:test with the fix, on a cold sandbox: 765 tests, no failures. This ran on the [ALT-11077] Support every Hyperskill step type and Next navigation between topics #68 branch, which has the same YamlTestUtils.kt as main; this branch itself is checked only by CI.

AddNewItemYamlTest failed with an NPE at line 57 when it was the first
test of a JVM with empty IDE caches, as on CI: the task config was missing.
createConfigFiles schedules the writes with invokeLater, and
UIUtil.dispatchAllInvocationEvents didn't run them there, even when called
for 5 seconds; they ran only after the test.

PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue releases the
write-intent lock while it dispatches and waits for an invokeLater
scheduled after them, so the configs are written before it returns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant